// ObjectPaternityMap.cpp: implementation of the ObjectPaternityMap class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "ObjectPaternityMap.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

namespace PDMS
{
	namespace PDMSDBIF
	{
		BEGIN_REGISTER_MAP( ObjectPaternityMap, MultiRecordsDatabaseElement)
		REGISTER( _T("PaternityMap"), GET_REGISTER( DatabaseElementFactory, Design_VersionOne ) )
		END_REGISTER_MAP();
		ObjectPaternityMap::ObjectPaternityMap()
		{
			
		}
		
		ObjectPaternityMap::~ObjectPaternityMap()
		{
			
		}

		StdString ObjectPaternityMap::GetOpenSQL( const StdString& strCondition )
		{
			StdString strSQL( _T("select * from PaternityMap") );
			if ( strCondition == ALLRECORD )
			{
				return strSQL;
			}
			return strSQL + _T(" where ") + strCondition;
		}

		StdString ObjectPaternityMap::GetTableName()
		{
			return StdString(_T("PaternityMap") );			
		}

		void ObjectPaternityMap::SetData( RecordPtr_ ptr )
		{
			m_ResPtr->SetLong( _T("ID"), ptr->GetID() );
			m_ResPtr->SetLong( _T("ParentID"), ptr->GetParentID() );
		}
		
		long ObjectPaternityMap::GetID() const 
		{
			ASSERT( m_ResPtr != NULL );
			return m_ResPtr->GetLong( _T("ID") );
		}
		
		long ObjectPaternityMap::GetParentID() const 
		{
			ASSERT( m_ResPtr != NULL );
			return m_ResPtr->GetLong( _T("ParentID") );
		}
	}
}
